/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 17655
 * Date: 2025-02-06
 * Time: 20:57
 */
public class test3 {
    /**
     * LeetCode 盛最多水的容器
     */

    public int maxArea(int[] height) {
        int left = 0;
        int right = height.length-1;
        int ret = 0;
        for(int i=0;i<height.length;i++){
            int sum = (right-left) * Math.min(height[left],height[right]);
            ret = Math.max(ret,sum);
            if(height[left]<height[right]){
                left++;
            }else{
                right--;
            }
        }
        return ret;
    }
}
